<template>
	<view>
		<view class="mainpadding titletext hei_text bold">基本資訊</view>
		<view class="mainpadding ffffff pdl">
			<view class="hui_text main_size bold">選擇行業</view>
			<view class="margin_top">
				<u-radio-group v-model="hy_type" placement="row" circle>
					<u-radio activeColor="#feb800" :customStyle="{marginRight: '5rpx'}" label="買賣" :name="0"></u-radio>
					<u-radio activeColor="#feb800" :customStyle="{marginRight: '5rpx'}" label="計時" :name="1"></u-radio>
					<!-- <u-radio activeColor="#feb800" :customStyle="{marginRight: '5rpx'}" label="診所" :name="2"></u-radio> -->
					<u-radio activeColor="#feb800" :customStyle="{marginRight: '5rpx'}" label="住宿露营"
						:name="3"></u-radio>
					<!-- <u-radio activeColor="#feb800" :customStyle="{marginRight: '5rpx'}" label="露营" :name="7"></u-radio> -->
					<!-- <u-radio activeColor="#feb800" label="租借" name="4"></u-radio> -->
					<u-radio activeColor="#feb800" :customStyle="{marginRight: '5rpx'}" label="工程" :name="5"></u-radio>
					<u-radio activeColor="#feb800" :customStyle="{marginRight: '5rpx'}" label="超商" :name="6"></u-radio>
				</u-radio-group>
			</view>
		</view>
		<view v-show="hy_type==0">
			<view class="mainpadding ffffff flexbetween pdl">
				<view class="hui_text main_size bold">是否開桌點餐</view>
				<view class="flexright">
					<u-radio-group v-model="opentable_status" placement="row" circle>
						<u-radio activeColor="#feb800" :customStyle="{marginRight: '10rpx'}" label="是"
							name="1"></u-radio>
						<u-radio activeColor="#feb800" label="否" name="0"></u-radio>
					</u-radio-group>
				</view>
			</view>
			<view class="mainpadding ffffff flexbetween pdl">
				<view class="hui_text main_size bold">是否最低消費</view>
				<view class="flexright">
					<u-radio-group v-model="is_zdxf" placement="row" circle>
						<u-radio activeColor="#feb800" :customStyle="{marginRight: '10rpx'}" label="是"
							name="1"></u-radio>
						<u-radio activeColor="#feb800" label="否" name="0"></u-radio>
					</u-radio-group>
				</view>
			</view>
		</view>
		<view v-show="hy_type==3">
			<view class="mainpadding ffffff pdl">
				<view class="hui_text main_size bold">住宿方式</view>
				<view class="margin_top">
					<u-checkbox-group v-model="checkboxValue1" placement="row">
						<u-checkbox activeColor="#feb800" :customStyle="{marginRight: '10rpx'}"
							v-for="(item, index) in checkboxList2" :key="index" :label="item.name" :name="item.value">
						</u-checkbox>
					</u-checkbox-group>
				</view>
			</view>
		</view>
		<view v-show="hy_type==3 || hy_type==7">
			<view class="flexbetween ffffff mainpadding pdl" @click="showtime('請選擇入住時間')">
				<view class="hui_text main_size bold">入住時間</view>
				<view class="flexleft">
					<input class="hei_text main_size bold textright" type="text" disabled="" v-model="join_time"
						placeholder="請選擇入住時間">
					<u-icon name="arrow-right" color="#999" size="16"></u-icon>
				</view>
			</view>
			<view class="flexbetween ffffff mainpadding pdl" @click="showtime('請選擇離開時間')">
				<view class="hui_text main_size bold">離開時間</view>
				<view class="flexleft">
					<input class="hei_text main_size bold textright" type="text" disabled v-model="lk_time"
						placeholder="請選擇離開時間">
					<u-icon name="arrow-right" color="#999" size="16"></u-icon>
				</view>
			</view>
			<view class="mainpadding ffffff flexbetween pdl">
				<view class="hui_text main_size bold">是否指定房間</view>
				<view class="flexright">
					<u-radio-group v-model="houtel_type" placement="row" circle>
						<u-radio activeColor="#feb800" :customStyle="{marginRight: '10rpx'}" label="指定"
							name="1"></u-radio>
						<u-radio activeColor="#feb800" label="不指定" name="2"></u-radio>
					</u-radio-group>
				</view>
			</view>
		</view>
		<view class="mainpadding ffffff flexbetween pdl">
			<view class="hui_text main_size bold">收款方式</view>
			<view class="flexright">
				<u-radio-group v-model="sk_type" placement="row" circle>
					<u-radio activeColor="#feb800" :customStyle="{marginRight: '10rpx'}" label="先收款"
						:name="1"></u-radio>
					<u-radio activeColor="#feb800" v-if="hy_type!=6" label="後收款" :name="2"></u-radio>
				</u-radio-group>
			</view>
		</view>

		<view class="mainpadding ffffff flexbetween pdl">
			<view class="hui_text main_size bold">點餐畫面</view>
			<view class="flexright">
				<u-radio-group v-model="pos_style" placement="row" circle>
					<u-radio activeColor="#feb800" :customStyle="{marginRight: '10rpx'}" label="POS畫面"
						:name="1"></u-radio>
					<u-radio activeColor="#feb800" v-if="hy_type!=6" label="列表畫面" :name="2"></u-radio>
				</u-radio-group>
			</view>
		</view>
		<!-- <view class="mainpadding ffffff flexbetween pdl">
			<view class="hui_text main_size bold">操作機型</view>
			<view class="flexright">
				<u-radio-group v-model="caozuo_jx" placement="row" circle>
					<u-radio activeColor="#feb800" :customStyle="{marginRight: '10rpx'}" label="手機"
						:name="1"></u-radio>
					<u-radio activeColor="#feb800" label="平板" :name="2"></u-radio>
				</u-radio-group>
			</view>
		</view> -->
		<view class="flexbetween ffffff mainpadding pdl">
			<view class="hui_text main_size bold">商家名稱</view>
			<input class="hei_text main_size bold textright" style="width: 80%;" type="text" placeholder="請輸入商家名稱"
				v-model="name">
		</view>

		<view class="flexbetween ffffff mainpadding pdl">
			<view class="hui_text main_size bold">統一編號</view>
			<input class="hei_text main_size bold textright" type="text" placeholder="請輸入統一編號" v-model="serialnum">
		</view>
		<view class="flexbetween ffffff mainpadding pdl">
			<view class="hui_text main_size bold">商家行動</view>
			<input class="hei_text main_size bold textright" type="number" placeholder="請輸入商家行動" v-model="shopmbl">
		</view>
		<view class="flexbetween ffffff mainpadding pdl">
			<view class="hui_text main_size bold">商家logo</view>
			<view class="flexleft">
				<view class="positionr margin_right1" v-for="(item,index) in logoimage_text" :key="index">
					<image class="listleftimg radius" :src="item" mode=""></image>
					<view class="deleteimg" @click="removeImg(logoimage,logoimage_text,index)"></view>
				</view>
				<image class="listleftimg radius" src="@/static/image/system/upimg.png" mode=""
					v-if="logoimage_text.length<1" @click="uploadImg(logoimage,logoimage_text,1)"></image>
			</view>
		</view>
		<view class="flexbetween ffffff mainpadding pdl">
			<view class="hui_text main_size bold">商家頂圖</view>
			<view class="flexleft">
				<view class="positionr margin_right1" v-for="(item,index) in topimages_text" :key="index">
					<image class="listleftimg radius" :src="item" mode=""></image>
					<view class="deleteimg" @click="removeImg(topimages,topimages_text,index)"></view>
				</view>
				<image class="listleftimg radius" src="@/static/image/system/upimg.png" mode=""
					v-if="topimages_text.length<3" @click="uploadImg(topimages,topimages_text,3)"></image>
			</view>
		</view>
		<view class="flexbetween ffffff mainpadding pdl">
			<view class="hui_text main_size bold">室内圖</view>
			<view class="flexleft">
				<view class="positionr margin_right1" v-for="(item,index) in inimages_text" :key="index">
					<image class="listleftimg radius" :src="item" mode=""></image>
					<view class="deleteimg" @click="removeImg(inimages,inimages_text,index)"></view>
				</view>
				<image class="listleftimg radius" src="@/static/image/system/upimg.png" mode=""
					v-if="inimages_text.length<3" @click="uploadImg(inimages,inimages_text,3)"></image>
			</view>
		</view>
		<view class="flexbetween ffffff mainpadding pdl">
			<view class="hui_text main_size bold">歇業</view>
			<u-switch inactiveColor="rgb(230, 230, 230)" v-model="xy_status" activeColor="#feb800"></u-switch>
		</view>
		<view class="mainpadding ffffff line_b9" v-if="appkey!=''">
			<view class="text_weight color_san white_nowrap">發票類型<text style="color: #ff0000;">*</text></view>
			<view class="margin_top flexbetween">
				<view :class="opentype==0?'flexleft select':'flexleft noSelect'" @click="opentype=0">
					<image class="vote1Img"
						:src="opentype==0?'/static/images/mine/vote1_active.png':'/static/images/mine/vote1.png'"
						mode=""></image>
					<view>紙本</view>
				</view>
				<view :class="opentype==1?'flexleft select':'flexleft noSelect'" @click="opentype=1">
					<image class="vote2Img"
						:src="opentype==1?'/static/images/mine/vote2_active.png':'/static/images/mine/vote2.png'"
						mode=""></image>
					<view>載具</view>
				</view>
				<view :class="opentype==2?'flexleft select':'flexleft noSelect'" @click="opentype=2">
					<image class="vote3Img"
						:src="opentype==2?'/static/images/mine/vote3_active.png':'/static/images/mine/vote3.png'"
						mode=""></image>
					<view>統編</view>
				</view>
				<view :class="opentype==3?'flexleft select':'flexleft noSelect'" @click="opentype=3">
					<image class="vote4Img"
						:src="opentype==3?'/static/images/mine/vote4_active.png':'/static/images/mine/vote4.png'"
						mode=""></image>
					<view>捐贈</view>
				</view>
			</view>
			<view class="invoiceInput margin_top flexbetween" v-show="opentype!=0">
				<input class="text_b" type="text" placeholder="請輸入手機載具" v-show="opentype==1" v-model="zjcode">
				<input class="text_b" type="text" placeholder="請輸入統一編碼" v-show="opentype==2" @blur="getTt()"
					v-model="tbcode">
				<input class="text_b" type="text" placeholder="請輸入捐贈碼" v-show="opentype==3" v-model="jzcode">
				<view class="" v-show="opentype==1 || opentype==3" @click="getCode()">
					<u-icon name="scan" color="#ffb800" size="28"></u-icon>
				</view>
			</view>
			<view class="invoiceInput margin_top" v-show="opentype==2">
				<input class="text_b" type="text" placeholder="請輸入發票抬頭" v-model="tbmc">
			</view>
		</view>

		<view class="flexbetween ffffff mainpadding pdl">
			<view class="hui_text main_size bold">營業區域</view>
			<view class="flexleft">
				<uni-data-picker @change="bindPickerChange" :localdata="items" v-model="address.county">
					<input class="hei_text main_size bold textright" type="text" v-model="addre"
						placeholder="請選擇所在營業區域">
				</uni-data-picker>
				<u-icon name="arrow-right" color="#999" size="16"></u-icon>
			</view>
			<!-- <view class="flexleft">
				<input class="hei_text main_size bold textright" type="text" disabled v-model="addre" placeholder="請選擇所在營業區域">
				<u-icon name="arrow-right" color="#999" size="16"></u-icon>
			</view> -->
		</view>
		<view class="flexbetween ffffff mainpadding pdl">
			<view class="hui_text main_size bold" style="min-width: 120rpx;">營業地址</view>
			<view class="flexright" style="width: 100%;">
				<input class="hei_text main_size bold textright" style="width: 100%;" type="text" placeholder="請輸入營業地址"
					v-model="address">
			</view>
		</view>
		<view class="flexbetween ffffff mainpadding pdl">
			<view class="hui_text main_size bold">起送費</view>
			<input class="hei_text main_size bold textright" type="text" autocorrect="off" autocapitalize="off"
				autocomplete="off" placeholder="請輸入起送費" v-model="deliveryfee">
		</view>
		<!-- <view class="flexbetween ffffff mainpadding pdl">
			<view class="hui_text main_size bold">是否營業</view>
			<u-switch inactiveColor="rgb(230, 230, 230)" v-model="is_yes" activeColor="#feb800"></u-switch>
		</view> -->
		<view class="flexbetween ffffff mainpadding pdl">
			<!-- <view class="flexbetween ffffff mainpadding pdl" v-show="is_yes"> -->
			<view class="hui_text main_size bold">營業時間</view>
			<view class="flexright" @click="goAddTrade">
				<input class="hei_text main_size bold textright" type="text" disabled placeholder="請設定營業時間"
					v-if="!addTimeList">
				<view class="hei_text main_size bold textright" v-else>已設定</view>
				<u-icon name="arrow-right" color="#999" size="16"></u-icon>
			</view>
		</view>
		<view class="flexbetween ffffff mainpadding pdl">
			<view class="hui_text main_size bold">退款密碼</view>
			<input class="hei_text main_size bold textright" type="password" autocorrect="off" autocapitalize="off"
				autocomplete="new-password" placeholder="請輸入退款密碼" v-model="paypassword">
		</view>
		<view class="flexbetween ffffff mainpadding pdl">
			<view class="hui_text main_size bold">uber_store_id</view>
			<input class="hei_text main_size bold textright" style="width: 80%;" type="text"
				placeholder="請輸入uber_store_id" v-model="uber_store_id">
		</view>
		<view class="mainpadding titletext hei_text bold">支付方式</view>
		<view class="flexbetween ffffff mainpadding pdl">
			<view class="hui_text main_size bold">多元支付</view>
			<u-switch inactiveColor="rgb(230, 230, 230)" v-model="dy_open" activeColor="#feb800"></u-switch>
		</view>
		<view class="flexbetween ffffff mainpadding pdl">
			<view class="hui_text main_size bold">現金支付</view>
			<u-switch inactiveColor="rgb(230, 230, 230)" v-model="xj_open" activeColor="#feb800"></u-switch>
		</view>
		<view class="mainpadding titletext hei_text bold">商家服務專案</view>
		<view class="flexbetween ffffff mainpadding pdl">
			<view class="hui_text main_size bold">外送</view>
			<u-switch inactiveColor="rgb(230, 230, 230)" v-model="is_ws" activeColor="#feb800"></u-switch>
		</view>
		<view class="flexbetween ffffff mainpadding pdl">
			<view class="hui_text main_size bold">自取</view>
			<u-switch inactiveColor="rgb(230, 230, 230)" v-model="is_zq" activeColor="#feb800"></u-switch>
		</view>
		<view class="flexbetween ffffff mainpadding pdl" v-if="hy_type!=5">
			<view class="hui_text main_size bold">內用</view>
			<u-switch inactiveColor="rgb(230, 230, 230)" v-model="is_ny" activeColor="#feb800"></u-switch>
		</view>
		<view class="flexbetween ffffff mainpadding pdl">
			<view class="hui_text main_size bold">票券</view>
			<u-switch inactiveColor="rgb(230, 230, 230)" v-model="is_pj" activeColor="#feb800"></u-switch>
		</view>
		<!-- <view class="flexbetween ffffff mainpadding pdl">
			<view class="hui_text main_size bold">統编</view>
			<input class="hei_text main_size bold textright" type="text" placeholder="請输入統编" v-model="chief">
		</view> -->
		<view class="mainpadding titletext hei_text bold">發票系統設定</view>

		<view class="flexbetween ffffff mainpadding pdl">
			<view class="hui_text main_size bold">列印抬頭</view>
			<input class="hei_text main_size bold textright" type="text" placeholder="請輸入列印抬頭" v-model="lytd">
		</view>
		<view class="ffffff mainpadding pdl" v-if="!logo_open">
			<view class="hui_text main_size bold">發票抬頭</view>
			<textarea class="hei_text main_size bold margin_top2" style="width: 100%;height: 80rpx;" type="text"
				placeholder="請輸入發票抬頭" v-model="fptd"></textarea>
		</view>
		<view class="flexbetween ffffff mainpadding pdl">
			<view class="hui_text main_size bold">發票Logo開關</view>
			<u-switch inactiveColor="rgb(230, 230, 230)" v-model="logo_open" activeColor="#feb800"></u-switch>
		</view>
		<view class="flexbetween ffffff mainpadding pdl" v-if="logo_open">
			<view class="hui_text main_size bold">發票logo</view>
			<view class="flexleft">
				<view class="positionr margin_right1" v-for="(item,index) in fplogo_text" :key="index">
					<image class="listleftimg radius" :src="item" mode=""></image>
					<view class="deleteimg" @click="removeImg(fplogo,fplogo_text,index)"></view>
				</view>
				<image class="listleftimg radius" src="@/static/image/system/upimg.png" mode=""
					v-if="fplogo_text.length<1" @click="uploadImg(fplogo,fplogo_text,1)"></image>
			</view>
		</view>
		<view class="flexbetween ffffff mainpadding pdl">
			<view class="hui_text main_size bold">App Key</view>
			<input class="hei_text main_size bold textright" style="width: 80%;" type="text" placeholder="請輸入App Key"
				v-model="appkey">
		</view>
		<view class="flexbetween ffffff mainpadding pdl">
			<view class="hui_text main_size bold">手動開發票(客戶)</view>
			<u-switch inactiveColor="rgb(230, 230, 230)" v-model="is_sdkfp" activeColor="#feb800"></u-switch>
		</view>
		<view class="flexbetween ffffff mainpadding pdl">
			<view class="hui_text main_size bold">手動開發票(呼叫)</view>
			<u-switch inactiveColor="rgb(230, 230, 230)" v-model="is_call_sdkfp" activeColor="#feb800"></u-switch>
		</view>
		<view class="flexbetween ffffff mainpadding pdl">
			<view class="hui_text main_size bold">手動開發票(Pos)</view>
			<u-switch inactiveColor="rgb(230, 230, 230)" v-model="is_pos_sdkfp" activeColor="#feb800"></u-switch>
		</view>
		<view class="flexbetween ffffff mainpadding ">
			<view class="hui_text main_size bold">商品固定名稱</view>
			<view class="flexright">
				<input class="main_size bold hei_text textright margin_right" style="width: 70%;" type="text"
					placeholder="請輸入發票固定名稱" v-model="fpgd_name" @confirm="addfpgd">
				<view class="addimg" @click="addfpgd"></view>
			</view>
		</view>
		<view class="flexleft flex-wrap ffffff mainpadding2" style="padding-bottom: 180rpx;">
			<view class="flexcenter margin_top margin_right"
				style="padding: 5px 15rpx;text-align: center; min-width: 100rpx; border-radius: 50rpx;border: 1rpx solid #ff0000;"
				v-for="(item,index) in fpgd_arr" :key="index">
				<text class="margin_right">{{item}}</text>
				<view class="" @click="fpgd_arr.splice(index,1)">
					<u-icon name="close-circle-fill" color="#ff0000" size="20"></u-icon>
				</view>
			</view>
		</view>
		<view class="mainpadding posibottom" style="bottom: 0;">
			<view class="submitbtn" @click="submit">確認</view>
		</view>
		<tki-tree ref="tkitree" :range="listData" :multiple="true" title="選擇城市" :foldAll="true" :selectParent="true"
			confirmColor="#ff8505" @confirm="treeConfirm" @cancel="treeCancel" />
		<timePicker :messageTime="messageTime" @timeConfirm="timeConfirm"></timePicker>
	</view>
</template>

<script>
	import citys from "../../static/city/city.js"
	export default {
		data() {
			return {
				shop_id: uni.getStorageSync("shop_id"),
				addressd: {
					province: "", //省
					city: "", //市
					county: "", //區
				},
				items: citys.data,

				name: "", //商家名称
				serialnum: "", //統一编号
				uber_store_id: "",
				fpgd_name: "", //發票固定名稱
				fpgd_arr: [],
				hy_type: 0, //行业类型:0=无,1=吃到饱,2=诊所,3=住宿,4=租借
				sk_type: 1, //1=先收款,2=後收款
				pos_style: 1,
				caozuo_jx: 1,
				shopmbl: "", //商家电话
				logoimage: [], //商家logo
				logoimage_text: [], //商家logo展示
				fplogo: [],
				fplogo_text: [],
				topimages: [], //商家顶图
				topimages_text: [], //商家顶图展示
				inimages: [],
				inimages_text: [],
				opentype: 0, //開票類型 0紙本 1載具 2統編 3捐贈
				jzcode: "", //開票内容
				tbcode: "", //開票内容
				zjcode: "", //開票内容
				tbmc: "",
				addre: '', //所在地址
				address: "", //详細地址
				deliveryfee: "", //起送费
				is_yes: false,
				is_ws: false, //是否外送:0=否,1=是
				is_zq: false, //是否自取:0=否,1=是
				is_ny: false, //是否内用:0=否,1=是
				is_pj: false, //是否票劵:0=否,1=是
				logo_open: false, //發票logo開關0否，1是
				is_sdkfp: false,
				is_call_sdkfp:false,
				is_pos_sdkfp: false,
				chief: "", //統编
				paypassword: "",
				appkey: "", //App Key
				fptd: "",
				lytd: "",
				addTimeList: "", //添加的營業時間
				listData: [],
				citysArr: [],
				dy_open: true,
				xy_status: false,
				xj_open: true,
				messageTime: {
					mode: "time",
					timeShow: false,
					title: "請選擇入住時間"
				},
				join_time: "",
				lk_time: "",
				checkboxList2: [],
				checkboxValue1: [],
				houtel_type: "1", //1=指定房间,2=不指定房间
				opentable_status: "0",
				is_zdxf: "0"
			}
		},
		onLoad() {
			this.checkboxList2 = getApp().globalData.zslxlist
			uni.$on("returnCode", data => {
				this.tbcode = data
			})
			let arr = JSON.parse(JSON.stringify(citys.data))
			let obj = arr[0]
			this.listData = obj.children
			this.getInfo()
		},
		onUnload() {
			uni.$off("returnCode")
		},
		onShow() {
			uni.$off("addTime")
			uni.$on("addTime", data => {
				console.log(data)
				this.addTimeList = data
			})
		},
		watch: {
			hy_type(newval) {
				if (newval == 6) {
					this.sk_type = 1
					this.pos_style = 1
				}
				if (newval == 5) {
					this.is_ny = false
				}
			}
		},
		methods: {
			authorizeUber() {
				uni.showLoading({
					mask: true,
					title: "請稍後"
				})
				this.http.request("/api/shop/getShopAuth", "GET", {
					shop_id: this.shop_id,
					uber_store_id: this.uber_store_id,
				}).then(res => {
					uni.hideLoading()
					if (res.code == 1) {
						console.log(res.data.url);
						return
						location.href = res.data.url;
					} else {
						this.http.toast(res.msg)
					}
				})
			},
			showtime(val) {
				this.messageTime.title = val
				this.messageTime.timeShow = true
			},
			timeConfirm(e) {
				if (this.messageTime.title == "請選擇入住時間") {
					this.join_time = e
					this.messageTime.title = "請選擇離開時間"
					this.messageTime.timeShow = true
				} else {
					this.lk_time = e
				}
			},
			addfpgd() {
				if (this.fpgd_name == "") {
					return false
				}
				this.fpgd_arr.push(this.fpgd_name)
				this.fpgd_name = ""
			},
			getCode() {
				uni.navigateTo({
					url: "/pages/my/getcodetwm"
				})
			},
			getTt() {
				if (this.opentype != 2) {
					return false
				}
				this.http.request("/api/user/getTbmc", "GET", {
					tbcode: this.tbcode
				}).then(res => {
					if (res.code == 1) {
						this.tbmc = res.data.tbinfo.name
					}
				})
			},
			goRegionSelect() { //地區選擇
				//打开選擇器
				this.$refs.tkitree._show();
			},
			treeConfirm(e) {
				this.citysArr = e
				this.addre = e[0].ptext + '/' + e[0].text
			},
			treeCancel(e) {
				//关闭選擇器
				this.$refs.tkitree._hide();
			},
			async getInfo() {
				uni.showLoading({
					mask: true,
					title: "請稍後"
				})
				let res = await this.http.request("/api/shop/Shopdeail", "POST", {
					shop_id: uni.getStorageSync("shop_id"),
				})
				uni.hideLoading()
				if (res.code == 1) {
					this.name = res.data.name
					this.serialnum = res.data.serialnum
					this.uber_store_id = res.data.uber_store_id
					this.fpgd_arr = res.data.fpgd_name.split(',')
					this.hy_type = res.data.hy_type
					this.sk_type = res.data.sk_type
					this.houtel_type = res.data.houtel_type.toString()
					uni.setStorageSync("houtel_type", this.houtel_type)
					this.pos_style = res.data.pos_style
					this.caozuo_jx = res.data.caozuo_jx
					this.shopmbl = res.data.shopmbl
					if (res.data.logoimage) {
						this.logoimage.push(res.data.logoimage)
						res.data.logoimage.split(",").forEach(item => {
							this.logoimage_text.push(this.imgUrlUser + item)
						})
					}
					if (res.data.fplogo) {
						this.fplogo.push(res.data.fplogo)
						res.data.fplogo.split(",").forEach(item => {
							this.fplogo_text.push(this.imgUrlUser + item)
						})
					}
					if (res.data.topimages) {
						this.topimages = res.data.topimages.split(",")
						res.data.topimages.split(",").forEach(item => {
							this.topimages_text.push(this.imgUrlUser + item)
						})
					}
					if (res.data.inimages) {
						this.inimages = res.data.inimages.split(",")
						res.data.inimages.split(",").forEach(item => {
							this.inimages_text.push(this.imgUrlUser + item)
						})
					}
					if (res.data.opentype != 0) {
						this.opentype = res.data.opentype
					}
					this.zjcode = res.data.zjcode == null ? "" : res.data.zjcode
					this.tbcode = res.data.tbcode == null ? "" : res.data.tbcode
					this.tbmc = res.data.tbmc == null ? "" : res.data.tbmc
					this.jzcode = res.data.jzcode == null ? "" : res.data.jzcode
					this.addre = res.data.addre
					this.address = res.data.address
					this.deliveryfee = res.data.deliveryfee
					this.is_yes = res.data.is_yes == 0 ? false : true
					this.is_ws = res.data.is_ws == 0 ? false : true
					this.is_zq = res.data.is_zq == 0 ? false : true
					this.is_ny = res.data.is_ny == 0 ? false : true
					this.is_pj = res.data.is_pj == 0 ? false : true
					this.logo_open = res.data.logo_open == 0 ? false : true
					this.is_sdkfp = res.data.is_sdkfp == 0 ? false : true
					this.is_call_sdkfp = res.data.is_call_sdkfp == 0 ? false : true
					
					this.is_pos_sdkfp = res.data.is_pos_sdkfp == 0 ? false : true

					this.xj_open = res.data.xj_open == 0 ? false : true
					this.dy_open = res.data.dy_open == 0 ? false : true
					this.xy_status = res.data.xy_status == 0 ? true : false
					this.chief = res.data.chief
					// this.paypassword = res.data.paypassword
					this.appkey = res.data.appkey
					this.fptd = res.data.fptd
					this.lytd = res.data.lytd
					this.lk_time = res.data.lk_time
					this.join_time = res.data.join_time
					this.addTimeList = {
						motime: res.data.motime, //周一營業時間
						tutime: res.data.tutime, //周二營業時間
						wetime: res.data.wetime, //周三營業時間
						thtime: res.data.thtime, //周四營業時間
						frtime: res.data.frtime, //周五營業時間
						satime: res.data.satime, //周六營業時間
						sutime: res.data.sutime, //周日營業時間
						motime_rate: res.data.motime_rate, //周一服務費
						tutime_rate: res.data.tutime_rate, //周二服務費
						wetime_rate: res.data.wetime_rate, //周三服務費
						thtime_rate: res.data.thtime_rate, //周四服務費
						frtime_rate: res.data.frtime_rate, //周五服務費
						satime_rate: res.data.satime_rate, //周六服務費
						sutime_rate: res.data.sutime_rate, //周日服務費
					}
					this.checkboxValue1 = res.data.zs_type ? res.data.zs_type.split(',') : [],
						this.opentable_status = res.data.opentable_status.toString()
					this.is_zdxf = res.data.is_zdxf.toString()
				} else if (res.code == 0) {
					this.http.toast(res.msg);
				} else {
					this.http.toast('系統處理中，請稍後再試');
				}
			},
			goAddTrade() { //添加營業時間
				uni.navigateTo({
					url: "/pages/workbench/addTradeTime?addTimeList=" + encodeURIComponent(JSON.stringify(this
						.addTimeList))
				})
			},
			bindPickerChange(val) {
				let area = val.detail.value
				let areas = [area[0].text, area[1].text, area[2].text];
				this.addre = JSON.parse(JSON.stringify(areas.join("/")));
				// this.address.province = area[0].value;
				// this.address.city = area[1].value;
				// this.address.county = area[2].value;
			},
			removeImg(arr, arr_text, index) {
				arr.splice(index, 1)
				arr_text.splice(index, 1)
			},
			async submit() { //提交
				if (this.is_ws == false && this.is_zq == false && this.is_ny == false) {
					this.http.toast("外送自取內用不能同時關閉");
					return
				}
				if (this.appkey != "") {
					if (this.opentype == 1 && !this.zjcode) {
						this.http.toast("請輸入手機載具！")
						return false
					}
					if (this.opentype == 2 && !this.tbcode) {
						this.http.toast("請輸入統一編碼！")
						return false
					}
					if (this.opentype == 2 && !this.tbmc) {
						this.http.toast("請輸入發票抬頭！")
						return false
					}
					if (this.opentype == 3 && !this.jzcode) {
						this.http.toast("請輸入捐贈碼！")
						return false
					}
				}
				if (this.hy_type == 3 || this.hy_type == 7) {
					if (this.join_time == "") {
						this.http.toast("請選擇入住時間！")
						return false
					}
					if (this.lk_time == "") {
						this.http.toast("請選擇離開時間！")
						return false
					}
					if (!this.checkboxValue1.length) {
						this.http.toast("請至少選擇一種住宿方式！")
						return false
					}
				}
				let data = {
					shop_id: this.shop_id,
					name: this.name, //商家名称
					serialnum: this.serialnum, //統一编号
					uber_store_id: this.uber_store_id,
					fpgd_name: this.fpgd_arr.join(), //發票固定名稱
					hy_type: this.hy_type,
					sk_type: this.sk_type,
					houtel_type: this.houtel_type,
					pos_style: this.pos_style,
					caozuo_jx: this.caozuo_jx,
					shopmbl: this.shopmbl, //商家电话
					logoimage: this.logoimage.join(), //商家logo
					fplogo: this.fplogo.join(),
					topimages: this.topimages.join(), //商家顶图
					inimages: this.inimages.join(), //商家顶图
					opentype: this.opentype, //開票類型 0紙本 1載具 2統編 3捐贈
					addre: this.addre, //所在地址
					address: this.address, //详細地址
					deliveryfee: this.deliveryfee ? this.deliveryfee : 0, //起送费
					is_yes: this.is_yes ? 1 : 0, //是否營業:0=否,1=是
					is_ws: this.is_ws ? 1 : 0, //是否外送:0=否,1=是
					is_zq: this.is_zq ? 1 : 0, //是否自取:0=否,1=是
					is_ny: this.is_ny ? 1 : 0, //是否内用:0=否,1=是
					is_pj: this.is_pj ? 1 : 0, //是否票劵:0=否,1=是
					logo_open: this.logo_open ? 1 : 0,
					is_sdkfp: this.is_sdkfp ? 1 : 0,
					is_call_sdkfp: this.is_call_sdkfp ? 1 : 0,
					
					is_pos_sdkfp: this.is_pos_sdkfp ? 1 : 0,
					chief: this.chief, //統编
					appkey: this.appkey, //App Key
					fptd: this.fptd,
					lytd: this.lytd,
					dy_open: this.dy_open ? 1 : 0,
					xy_status: this.xy_status ? 0 : 1,
					xj_open: this.xj_open ? 1 : 0,
					lk_time: this.lk_time,
					join_time: this.join_time,
					paypassword: this.paypassword,
					zs_type: this.checkboxValue1.join(),
					opentable_status: this.opentable_status,
					is_zdxf: this.is_zdxf,
					...this.addTimeList
				}
				if (this.appkey != "") {
					if (this.opentype == 1) {
						this.$set(data, "zjcode", this.zjcode)
						this.$set(data, "tbmc", this.tbmc)
					}
					if (this.opentype == 2) {
						this.$set(data, "tbcode", this.tbcode)
						this.$set(data, "tbmc", this.tbmc)
					}
					if (this.opentype == 3) {
						this.$set(data, "jzcode", this.jzcode)
						this.$set(data, "tbmc", this.tbmc)
					}
				}
				uni.showLoading({
					mask: true,
					title: "請稍後"
				})
				let res = await this.http.request("/api/shop/Shopedit", "POST", data)
				uni.hideLoading()
				if (res.code == 1) {
					this.http.toast("修改成功");
					setTimeout(() => {
						uni.navigateBack(1)
					}, 500)
				} else if (res.code == 0) {
					this.http.toast(res.msg);
				} else {
					this.http.toast('系統處理中，請稍後再試');
				}
			}
		}
	}
</script>

<style scoped>
	.hui_text {
		color: #666;
	}

	.pdl {
		border-bottom: 1rpx solid rgba(0, 0, 0, .03);
	}

	.select {
		width: 154rpx;
		height: 69rpx;
		text-align: center;
		line-height: 69rpx;
		background: rgba(255, 133, 5, 0.1);
		border-radius: 8rpx 8rpx 8rpx 8rpx;
		border: 2rpx solid #FF8505;
		font-size: 24rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #FF8505;
		position: relative;
	}

	.select::after {
		content: '';
		width: 25rpx;
		height: 20rpx;
		position: absolute;
		right: 0;
		bottom: 0;
		background-image: url('/static/images/mine/invoice_select.png');
		background-size: 100% 100%;
	}

	.vote1Img {
		width: 26rpx;
		height: 26rpx;
		margin-left: 20rpx;
		margin-right: 10rpx;
	}

	.vote2Img {
		width: 23.5rpx;
		height: 23.5rpx;
		margin-left: 20rpx;
		margin-right: 10rpx;
	}

	.vote3Img {
		width: 29rpx;
		height: 29rpx;
		margin-left: 20rpx;
		margin-right: 10rpx;
	}

	.vote4Img {
		width: 27rpx;
		height: 27rpx;
		margin-left: 20rpx;
		margin-right: 10rpx;
	}

	.noSelect {
		width: 154rpx;
		height: 69rpx;
		text-align: center;
		line-height: 69rpx;
		background: rgba(102, 102, 102, .1);
		border-radius: 8rpx 8rpx 8rpx 8rpx;
		border: 2rpx solid rgba(102, 102, 102, .1);
		font-size: 24rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #666666;
	}

	.invoiceInput {
		width: 100%;
		height: 91rpx;
		background: rgba(196, 196, 196, .1);
		border-radius: 8rpx 8rpx 8rpx 8rpx;
		display: flex;
		align-items: center;
		padding-left: 20rpx;
	}

	.qxbtn {
		background-color: #004FA3;
		color: #fff;
		font-size: 24rpx;
		font-weight: 900;
		padding: 10rpx 20rpx;
		border-radius: 10rpx;
		letter-spacing: 3rpx;
	}
</style>